﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Kokomo.PeInspector.Reflection
{
	class SearchResult
	{
		public MemberInfo Member { get; private set; }
		public MemberViewInfo ViewInfo { get; private set; }
		public MemberViewInfo TypeViewInfo { get; private set; }
		public string MemberName { get { return this.Member.Name; } }
		public string TypeName { get { return this.TypeViewInfo.Title; } }

		public SearchResult(
			MemberInfo member,
			MemberViewInfo viewInfo,
			MemberViewInfo typeViewInfo
			)
		{
			if (member == null) throw new ArgumentNullException("member");

			this.Member = member;
			this.ViewInfo = viewInfo;
			this.TypeViewInfo = typeViewInfo;
		}

		public string AssemblyName
		{
			get
			{
				Type type = (this.Member as Type) ?? this.Member.ReflectedType;

				return type.Assembly.FullName;
			}
		}
	}
}
